package com.adteam.xmap.manager.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.adteam.xmap.entity.Picture;
import com.adteam.xmap.manager.PictureManager;

public class PictureManagerImpl extends HibernateDaoSupport implements PictureManager {

	public void addPicture(Picture picture) {

		getHibernateTemplate().save(picture);
	}

	public void delPicture(int id) {

		getHibernateTemplate().delete(findPictureById(id));
	}

	public List findAllPictures() {

		return getHibernateTemplate().find("select p from Picture p");
	}

	public Picture findPictureById(int id) {

		return (Picture)getHibernateTemplate().load(Picture.class, id);
	}

	public void updatePicture(Picture picture) {

		getHibernateTemplate().update(picture);
	}

}
